//
// Created by 11510 on 2024/6/8.
//
#include <string.h>
#include <unistd.h>
#include <iostream>
#include <fstream>
using std::cin;
using std::cerr;
using std::cout;
using std::endl;
using std::ifstream;
using std::ofstream;
using std::string;

void test0(){
    const char * filename = "res.txt";

    // 不存在创建
    // 版本过低，不支持string构造
    // 当前文件存在，截断
    /* ofstream ofs(filename.c_str()); */

    ofstream ofs(filename, std::ios::app);

    if(ofs == NULL){
        cerr << "ifstream open file failed" << endl;
    }

    string line = "helloworld\n";
    ofs << line;

    /**
     * 动态查看指令 tail
     */
}

int main() {
    test0();
    return 0;
}